D i m   a r r S c a l e 5 Q u e s t i o n s   =   S u r v e y . Q u e s t i o n s . F i l t e r B y T a g ( " 5 p t   S c a l e   B r a n d   L o o p " )   '   t a g g e d :   B 5 
 D i m   a r r S c a l e 7 Q u e s t i o n s   =   S u r v e y . Q u e s t i o n s . F i l t e r B y T a g ( " 7 p t   S c a l e   B r a n d   L o o p " )   '   t a g g e d :   R 4 
 D i m   a r r S c a l e 1 0 Q u e s t i o n s   =   S u r v e y . Q u e s t i o n s . F i l t e r B y T a g ( " S e a s o n a l   R a t i n g " )   '   t a g g e d :   E 1 
 D i m   r e s P o r t f o l i o   A s   P o r t f o l i o 
 
 D i m   i   
 F o r   i   =   1   t o   3   '   I t e r a t e   t h r o u g h   3   t a b   d e f i n i t i o n s   w e   w a n t   t o   c r e a t e 
     D i m   r e s I t e m   A s   P o r t f o l i o I t e m 
     D i m   P r o f i l e R o w   a s   P r o f i l e 
     
     D i m   a r r S c a l e Q u e s t i o n s   =   O n ( i , a r r S c a l e 5 Q u e s t i o n s , a r r S c a l e 7 Q u e s t i o n s , a r r S c a l e 1 0 Q u e s t i o n s ) 
     D i m   a r r T o p B o x   =   O n ( i , { 1 ; 2 } , { 5   t o   7 } , { 8   t o   1 0 } ) 
     D i m   a r r B o t t o m B o x   =   O n ( i , { 4 ; 5 } , { 1   t o   3 } , { 1   t o   4 } ) 
     D i m   s t r T o p B o x C a p t i o n   =   O n ( i , " N E T   ( T 2 B ) " , " N E T   ( T 3 B ) " , " N E T   ( T 3 B ) " ) 
     D i m   s t r B o t t o m B o x C a p t i o n   =   O n ( i , " N E T   ( B 2 B ) " , " N E T   ( B 3 B ) " , " N E T   ( B 4 B ) " ) 
     D i m   s t r T a b T i t l e s   =   O n ( i , " 5 p t   S c a l e   Q u e s t i o n s   w i t h   T 2 / B 2   N E T S " , " 7 p t   S c a l e   Q u e s t i o n s   w i t h   T 3 / B 3   N E T S " , " 1 0 p t   S c a l e   Q u e s t i o n s   w i t h   T 3 / B 4   N E T S " ) 
     
     D i m   h 
     F o r   h   =   1   t o   S u r v e y . Q u e s t i o n s . C o u n t 
         D i m   c u r r Q u e s t i o n     =   S u r v e y . Q u e s t i o n s [ h ] 
     ' S c a l e   q u e s t i o n s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
         I f   a r r S c a l e Q u e s t i o n s . F i n d B y S h o r t c u t ( c u r r Q u e s t i o n . S h o r t c u t ) . S h o r t c u t   < >   " "   a n d   c u r r Q u e s t i o n . I s C o d i n g   =   F a l s e   T h e n 
             P r o f i l e R o w . A d d ( c u r r Q u e s t i o n )   '   t h e   p r o f l e   o f   q u e s t i o n s   i s   a l w a y s   b u i l d i n g 
             D i m   c u r r Q u e s t i o n P r o f i l e   a s   P r o f i l e Q u e s t i o n   =   P r o f i l e R o w . P r o f i l e Q u e s t i o n s [ P r o f i l e R o w . P r o f i l e Q u e s t i o n s . C o u n t ]   '   A l w a y s   t a k e   t h e   l a s t   q u e s t i o n   a d d e d   t o   t h e   p r o f i l e 
 
             D i m   n e t R e s p T B   a s   P r o f i l e I t e m   '   1 s t   G r o u p e d   r e s p o n s e   f o r   a l l   S c a l e   q u e s t i o n s 
             n e t R e s p T B . C a p t i o n   =   s t r T o p B o x C a p t i o n 
             n e t R e s p T B . T y p e   =   1 
             c u r r Q u e s t i o n P r o f i l e . A d d ( n e t R e s p T B ) 
 
             D i m   n e t R e s p B B   a s   P r o f i l e I t e m   '   2 n d   g r o u p e d   r e s p o n s e   f o r   a l l   S c a l e   q u e s t i o n s 
             n e t R e s p B B . C a p t i o n   =   s t r B o t t o m B o x C a p t i o n 
             n e t R e s p B B . T y p e   =   1 
             c u r r Q u e s t i o n P r o f i l e . A d d ( n e t R e s p B B ) 
 
             D i m   k   '   U s e   t o   l o o p   t h r o u g h   a l l   r e s p o n s e s   a n d   a d d   r e q u i r e d   o n e s   t o   t h e i r   g r o u p s 
             F o r   k   =   1   t o   c u r r Q u e s t i o n . R e s p o n s e s . C o u n t - 1 
                 D i m   m y R e s p o n s e s   a s   P r o f i l e I t e m 
                 m y R e s p o n s e s . T y p e   =   0 
                 m y R e s p o n s e s . R e s p o n s e   =   k 
                 m y R e s p o n s e s . S e l e c t e d   =   F a l s e 
                 I f   k   i n   a r r T o p B o x   T h e n   
                     c u r r Q u e s t i o n P r o f i l e . A d d ( m y R e s p o n s e s ,   n e t R e s p T B ) 
                 E l s e I f   k   i n   a r r B o t t o m B o x   T h e n   
                     c u r r Q u e s t i o n P r o f i l e . A d d ( m y R e s p o n s e s ,   n e t R e s p B B ) 
                 E n d i f 
             N e x t   k 
         E n d i f 
     ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
     N e x t   h 
             r e s I t e m . S e t T y p e ( 1 ) 
             r e s I t e m . S e t T i t l e ( s t r T a b T i t l e s ) 
             r e s I t e m . T a b D e f . R e a d T a b T e m p l a t e ( " A s k i a   S i m p l e " ) 
             r e s I t e m . T a b D e f . R o w s . a d d ( P r o f i l e R o w )                 
             r e s P o r t f o l i o . a d d ( r e s I t e m ) 
 N e x t   i 
 ' A d d   a   4 t h   t a b   d e f i n i t i o n   f o r   m u l t i p l e   q u e s t i o n s   w i t h   c a l c u l a t e d   r e s p o n s e   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
     D i m   r e s I t e m 2   A s   P o r t f o l i o I t e m 
     D i m   P r o f i l e R o w 2   a s   P r o f i l e 
 
 D i m   j 
     F o r   j   =   1   t o   S u r v e y . Q u e s t i o n s . C o u n t 
     D i m   c u r r Q u e s t i o n 2   =   S u r v e y . Q u e s t i o n s [ j ] 
     I f   c u r r Q u e s t i o n 2 . T y p e   =   " m u l t i p l e "   a n d   c u r r Q u e s t i o n 2 . I s C o d i n g   =   F a l s e   T h e n   
             P r o f i l e R o w 2 . A d d ( c u r r Q u e s t i o n 2 )   '   t h e   p r o f l e   o f   q u e s t i o n s   i s   a l w a y s   b u i l d i n g 
             D i m   c u r r Q u e s t i o n P r o f i l e 2   a s   P r o f i l e Q u e s t i o n   =   P r o f i l e R o w 2 . P r o f i l e Q u e s t i o n s [ P r o f i l e R o w 2 . P r o f i l e Q u e s t i o n s . C o u n t ]   '   A l w a y s   t a k e   t h e   l a s t   q u e s t i o n   a d d e d   t o   t h e   p r o f i l e 
             D i m   c a l c R e s p S u m A l l   a s   P r o f i l e I t e m 
             c a l c R e s p S u m A l l . C a p t i o n   =   " S u m   o f   a l l   r e s p o n s e s " 
             c a l c R e s p S u m A l l . T y p e   =   2 
             c a l c R e s p S u m A l l . S c r i p t   =   " S u m A l l " 
             c u r r Q u e s t i o n P r o f i l e 2 . A d d ( c a l c R e s p S u m A l l ) 
         E n d i f 
 N e x t   j 
             r e s I t e m 2 . S e t T y p e ( 1 ) 
 	     r e s I t e m 2 . S e t T i t l e ( " M u l t i p l e   Q u e s t i o n s   W i t h   C a l c u l a t e d   R e s p o n s e " ) 
             r e s I t e m 2 . T a b D e f . R e a d T a b T e m p l a t e ( " A s k i a   S i m p l e " ) 
             r e s I t e m 2 . T a b D e f . R o w s . a d d ( P r o f i l e R o w 2 )                 
             r e s P o r t f o l i o . a d d ( r e s I t e m 2 ) 
     ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 r e s P o r t f o l i o . S a v e ( S u r v e y . D i r e c t o r y   +   " 1 0 b .   C a l c u l a t e d   &   G r o u p e d   R e s p o n s e s   U s i n g   S c r i p t   ( S e v e r a l   Q u e s t i o n s   &   T a b   D e f i n i t i o n s ) . x m l " ) 
 r e s P o r t f o l i o . O p e n ( ) 